//
//  MBProgressHUD+XDPrompt.m
//  tangchengyipin
//
//  Created by XiangDongMBP on 16/3/15.
//  Copyright © 2016年 XiangDong. All rights reserved.
//

#import "MBProgressHUD+XDPrompt.h"

NSTimeInterval const kXDAutoHideTimeLength = 1.5;

@implementation MBProgressHUD (XDPrompt)

+ (instancetype)showPromptWithAutoHideInView:(UIView *)view message:(NSString *)msg {
    MBProgressHUD * hud = [[self class] showHUDAddedTo:view animated:YES];
    hud.mode = MBProgressHUDModeText;
    if ([msg isKindOfClass:[NSNull class]] || !msg) {
        hud.detailsLabel.text = @"Nothing";
//        hud.detailsLabelText = @"空提示";
    } else {
        hud.detailsLabel.text = msg;
//        hud.detailsLabelText = msg;
    }
    hud.removeFromSuperViewOnHide = YES;
    [hud hideAnimated:YES afterDelay:kXDAutoHideTimeLength];
//    [hud hide:YES afterDelay:kXDAutoHideTimeLength];
    return hud;
}
@end
